/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session.stateless;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import persistence.entity.Biller;

/**
 *
 * @author Craig
 */
@Stateless
public class BillerFacade extends AbstractFacade<Biller> implements BillerFacadeRemote {
    @PersistenceContext(unitName = "Entity-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public BillerFacade() {
        super(Biller.class);
    }

    @Override
    public Integer getAccountID(int billerID) {
        Biller biller = find(billerID);
        if (biller == null) {
            return null;
        }
        return biller.getBillerAccountId().getAccountId();
    }

    @Override
    public boolean isValidBillerID(Integer billerID) {
        Biller biller = find(billerID);
        return biller != null;
    }
    
}
